package qc.module.platform.service;


import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import qc.common.core.unify.QCUnifyReturnValue;
import qc.module.platform.entity.QcRoleResource;
import qc.module.platform.repository.QcRoleResourceRepository;

@Service
public class RoleResourceService {

    private QcRoleResourceRepository qcRoleResourceRepository;

    @Autowired
    public void setQcRoleResourceRepository(QcRoleResourceRepository qcRoleResourceRepository) {
        this.qcRoleResourceRepository = qcRoleResourceRepository;
    }

    /**
     * 删除角色与资源的关联关系
     *
     * @param id 角色id
     * @return 成功返回null
     */
    public String deleteByRoleId(int id) {
        LambdaUpdateWrapper<QcRoleResource> wrapper = new LambdaUpdateWrapper<>();
        wrapper.eq(QcRoleResource::getRoleid, id);
        qcRoleResourceRepository.delete(wrapper);
        return QCUnifyReturnValue.Success();
    }

}
